document.addEvent('domready', function() {
	document.id('load').addEvent('submit', function(e) {
		e.preventDefault();
		new Card(Number.random(1, 422), Number.random(90,110), Number.random(90,110));
	});
	
	var windowSizeChange = function() {
		var windowSize = window.getSize();
		var resizeFactorX = windowSize.x / 1400;
		var resizeFactorY = windowSize.y / 1000;
		var resizeFactor = resizeFactorX < resizeFactorY ? resizeFactorX : resizeFactorY;
		resizeFactor = resizeFactor > 1 ? 1 : resizeFactor;
		Playground.setResizeFactor(resizeFactor);
	}
	window.addEvent('resize', windowSizeChange);
	windowSizeChange();
	
	var newChips = function(radius, color, borderColor, text, top, left) {
		for(var i = 0; i < 3; i++) {
			new Chip(radius, color, borderColor, text, Number.random(top-6, top+6), Number.random(left-6, left+6));
		}
	}
	newChips(25, 'brown', 'black', 'D', 650, 25);
	newChips(15, 'pink', 'red', '1', 690, 50);
	newChips(15, 'pink', 'red', '5', 710, 75);
	newChips(15, 'pink', 'red', '20', 730, 50);
	newChips(15, 'pink', 'red', '50', 750, 75);
	newChips(35, 'yellow', 'orange', 'S', 900, 50);
});